#ifndef __drv_l1_MIPI_DSI_H__
#define __drv_l1_MIPI_DSI_H__

#include "driver_l1.h"

#define MASK_3_BIT		0x7
#define MASK_5_BIT		0x1F
#define MASK_8_BIT		0xFF
#define MASK_16_BIT		0xFFFF

#define SHIFT_24_BIT	24
#define SHIFT_20_BIT	20
#define SHIFT_16_BIT	16
#define SHIFT_8_BIT		8

// DSI INT status
#define DSI_STATUS_RX_DFULL		(1 << 29)
#define DSI_STATUS_RX_DAFULL	(1 << 28)
#define DSI_STATEUS_ACK_TRIG	(1 << 24)

// DSI OP Control Setting
#define DSI_OP_RSP_RDEN		(1 << 28)
#define DSI_OP_TXLPDT		(1 << 20)
#define DSI_OP_LONG_BTA_EN	(1 << 13)
#define DSI_OP_SHORT_BTA_EN (1 << 12)

// DSI Control Setting
#define DSI_ANALOG_PHY_EN			(1 << 24)
#define B_DISP_EOTP_PACKET_EN		(1 << 12)
#define B_DISP_DATA_LANE			4
#define DSI_DATA_LANE_MASK			(3 << B_DISP_DATA_LANE)
#define DSI_ENGINE_COMMAND_TXLP_EN	(1 << 2)
#define DSI_ENGINE_COMMAND_MODE_EN	(1 << 1)
#define DSI_ENGINE_EN				(1 << 0)

// Interrupt Status
#define DSI_STATE_RX_DFULL	(1 << 29)
#define DSI_STATE_RX_DAFULL (1 << 28)
#define DSI_STATE_ACK_TRIG	(1 << 24)

extern void		drv_l1_mipi_dsi_eotp_packet_enable(INT32U enable);
extern void		drv_l1_mipi_dsi_lpck_set(INT32U divide);
extern INT32U	drv_l1_mipi_dsi_ack_error_response_status_get(void);
extern INT32S	drv_l1_mipi_dsi_int_status_get(INT32U mask, INT32U time_out);
extern void		drv_l1_mipi_dsi_bta_timing_set(INT32U ta_get, INT32U ta_sure, INT32U ta_go);
extern void		drv_l1_mipi_dsi_memory_window_read_enable(INT32U enable);
extern void		drv_l1_mipi_dsi_short_BTA_enable(INT32U enable);
extern void		drv_l1_mipi_dsi_long_BTA_enable(INT32U enable);
extern void		drv_l1_mipi_dsi_tx_lpdt_enable(INT32U enable);
extern void		drv_l1_mipi_dsi_short_packet_header_set(INT32U data_type, INT32U data0, INT32U data1);
extern void		drv_l1_mipi_dsi_long_packet_header_set(INT32U data_type, INT32U byte_cnt, INT8U *data_ptr);
extern void		drv_l1_mipi_dsi_analog_phy_enable(INT32U enable);
extern void		drv_l1_mipi_dsi_data_lane_set(INT32U number);
extern void		drv_l1_mipi_dsi_command_tx_type_set(INT32U type);
extern void		drv_l1_mipi_dsi_command_mode_enable(INT32U enable);
extern void		drv_l1_mipi_dsi_enable(INT32U enable);
#endif /* __drv_l1_MIPI_DSI_H__ */
